# 定义密钥
key = 'deceptive'
# 定义加密函数
def encrypt(message, key):
    flag = 0 #记录当前扫描到的位置
    encrypted_message = ''
    for char in message:
        if char.islower():
            offset = (ord(key[flag % len(key)])-ord('a')+ ord(char)-ord('a')) % 26
            encrypted_char = chr(offset + ord('a'))
            encrypted_message += encrypted_char
            flag+=1
        elif char.isupper():
            offset = (ord(key[flag % len(key)])-ord('a')+ ord(char)-ord('A')) % 26
            encrypted_char = chr(offset + ord('A'))
            encrypted_message += encrypted_char
            flag+=1
        else:
            encrypted_message += char
    return encrypted_message
# 测试加密函数
message = 'We are discovered save yourself'
encrypted_message = encrypt(message, key)
print('Encrypted message:', encrypted_message)